package top.jacktgq.sxt.bio.demo1;

import java.net.InetSocketAddress;

/**
 * @Author CandyWall
 * @Date 2019/10/20--16:55
 * @Description 端口：
 *                  1、区分软件
 *                  2、2个字节 0-65535 UDP TCP
 *                  3、同一个协议端口不能冲突
 *                  4、定义端口越大越好
 *              InetSocketAddress(地址，域名，端口)
 */
public class PortTest {
    public static void main(String[] args) {
        //包含端口
        InetSocketAddress socketAddress1 = new InetSocketAddress("127.0.0.1", 8080);
        InetSocketAddress socketAddress2 = new InetSocketAddress("localhost", 9000);
        System.out.println(socketAddress1.getHostName());
        System.out.println(socketAddress2.getAddress());
        System.out.println(socketAddress2.getPort());
    }

}
